<template>
  <div class="wk">

    <div class="otitle">
      <div class="bis"></div>
      <div class="sis"></div>

      <div class="user">

        <div class="uleft">
          <van-icon class="img" size="70" name="fire-o" />

          <div class="tuser">
            <div class="uname"> {{ userinfo.nickName }} </div>
            <div class="order"> vvip </div>
          </div>

        </div>

        <div class="uright">
          <van-icon class="img" size="30" name="fire-o" />

          <div class="roredr">
            <van-icon class="icon" size="25" name="fire-o" />

            <div class="rotext">
              <div>pro会员</div>
              <div>立即开通$</div>
            </div>

          </div>

        </div>

        <div class=""></div>
      </div>
    </div>

    <div class="mproperty">

      <div class="mtext">
        我的资产
      </div>

      <div class="resource">

        <div class="section">
          <van-icon class="num" dot> ${{ money }} </van-icon>
          <div>余额</div>
        </div>

        <div class="section">
          <van-icon class="num">{{ money }} </van-icon>
          <div>红包</div>
        </div>

        <div class="section">
          <van-icon class="num">{{ money }}</van-icon>
          <div>优惠券</div>
        </div>

        <div class="section">
          <van-icon class="num">{{ money }}</van-icon>
          <div>积分</div>
        </div>

        <div class="section">
          <van-icon class="num">{{ money }} </van-icon>
          <div>礼品卡</div>
        </div>

      </div>

      <div class="kar">
        <div class="lkar">
          <van-icon class="icon" size="25" name="fire-o" />
          <div class="otext">7周年</div>
          <div class="s"> | </div>
          <div class="ttext">花3得到4</div>
        </div>
        <div class="rkar">限时开通</div>
      </div>



    </div>

    <div class="kclass">

      <img src="" alt="">

      <div class="mclass">

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">我的订单</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">账号管理</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">我的手机号</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">周六一起拼</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">售后服务</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">邀请返利</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">优先购</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">积分中心</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">会员俱乐部</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">地址管理</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">支付安全</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">帮助与客服</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">意见反馈</div>
        </div>

        <div class="smclass">
          <van-icon class="icon" name="fire-o" />
          <div class="ltext">我的竞拍</div>
        </div>

      </div>

    </div>

    <van-button class="bottom-btn" @click="tc" color="#ffffff" size="large">退出登录</van-button>

    <van-dialog></van-dialog>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { storeToRefs } from 'pinia';
import { useRoute, useRouter } from 'vue-router';
export default defineComponent({
  name: 'PersonalCenter'
})
</script>
<script lang="ts" setup>
import 'vant/es/notify/style'
import { showConfirmDialog, showNotify } from 'vant';
import { useloginstore } from '@/stores/login'
import { guard } from '@/api/login/index'
import { ref, watch, computed, onMounted } from 'vue';
const show = ref(false)
let loginstore = useloginstore()
let route = useRoute()
let router = useRouter()
let { userinfo } = storeToRefs(loginstore)
let mstore = userinfo.value.nickName

guard(route, router, mstore, watch)

let money = computed(() => {
  if (userinfo.value.nickName) {
    return 9999
  } else {
    return 0
  }
})

function tc() {
  show.value = true

  showConfirmDialog({
    message:
      '退出登录？',
  })
    .then(() => {
      localStorage.removeItem('token_key')
      userinfo.value = { nickName: '' }
      showNotify({ type: 'primary', message: '那种事我不要啊' });
      router.push({ path: '/index' })
      // on confirm
    })
    .catch(() => {
      // on cancel
    });
}


</script>

<style lang="less" scoped>
.wk {
  background-color: aliceblue;
  // margin-bottom: 50px;
  height: 100%;
}

.otitle {
  overflow: hidden;
  position: relative;
  padding-left: 16px;
  display: flex;
  align-items: center;
  height: 150px;
  color: aliceblue;
  background-color: rgb(243, 202, 127);

  .bis {
    position: absolute;
    left: -17px;
    border-top: 360px solid rgba(248, 212, 140, 0.4);
    border-bottom: 260px solid transparent;
    border-left: 260px solid transparent;
    border-right: 260px solid transparent;
  }

  .sis {
    position: absolute;
    top: 0;
    left: 205px;
    border-top: 40px solid rgba(250, 215, 142, 0.8);
    border-bottom: 40px solid transparent;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
  }

  .user {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;

    .uleft {
      width: 270px;
      display: flex;
      align-items: center;

      .img {
        margin-right: 20px;
        width: 78px;
        height: 78px;
        border-radius: 50%;
      }

      .tuser {
        .uname {
          font-size: 20px;
        }

        .order {
          font-size: 16px;
        }
      }
    }

    .uright {
      height: 104px;
      position: absolute;
      right: -20px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;

      .img {
        margin-left: 80px;
        width: 35px;
        height: 35px;
      }

      div {
        font-size: 14px;
      }

      .roredr {
        padding-left: 15px;
        display: flex;
        align-items: center;
        width: 140px;
        border-radius: 30px;
        background-color: black;

        .icon {
          border-radius: 50%;
          margin-right: 10px;
          border-radius: 50%;
          width: 31px;
          height: 31px;
        }

        .rotext {
          color: rgb(247, 222, 190);

          div {
            margin: 5px 0;
          }
        }
      }
    }
  }
}

.mproperty {
  display: flow-root;
  background-color: white;
  margin-bottom: 20px;
  padding-left: 20px;

  .mtext {
    height: 58px;
    line-height: 58px;
    font-size: 18px;
    border-bottom: 1px solid;
  }

  .resource {
    display: flex;
    justify-content: space-around;
    align-items: center;

    .section {
      font-size: 16px;
      margin-top: 20px;
      height: 75px;
      display: flex;
      flex-direction: column;
      align-items: center;

      .num {
        font-weight: bolder;
        margin-bottom: 10px;
      }
    }
  }

  .kar {
    border: 1px solid rgb(253, 231, 230);
    border-radius: 10px;
    margin-right: 20px;
    margin-bottom: 20px;
    padding: 0 10px;
    height: 50px;
    font-size: 16px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background-color: rgb(254, 245, 243);

    .lkar {
      display: flex;
      align-items: center;

      .icon {
        width: 30px;
        height: 30px;
      }

      .otext {
        margin-left: 5px;
      }

      .otext {
        font-weight: bold;
      }

      .s {
        margin: 0 5px;
      }
    }

    .rkar {
      height: 25px;
      padding: 0 11px;
      line-height: 25px;
      color: aliceblue;
      border-radius: 20px;
      background-color: rgb(221, 26, 33);
    }
  }
}

.kclass {
  background-color: white;
  margin-bottom: 25px;

  img {
    margin: 10px 20px;
  }

  .mclass {
    border-top: 1px solid rgb(242, 241, 241);
    display: flex;
    flex-wrap: wrap;

    .smclass {
      width: 33%;
      height: 99px;
      margin-top: 10px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      border-bottom: 1px solid rgb(234, 234, 234);
      border-right: 1px solid rgb(234, 234, 234);

      .ltext {
        font-size: 13px;
      }

      .icon {
        width: 30px;
        height: 30px;
        margin-bottom: 15px;
      }
    }
  }
}

.bottom-btn {
  margin-bottom: 60px;
  color: black;

  :deep(.van-button__text) {
    color: black;
  }
}
</style>
